package com.app.system.service.impl;/**
 * @program: app-admin
 * @name AppUserServiceImpl
 * @description: APP用户信息
 */

import com.app.common.enums.DeleteEnum;
import com.app.common.utils.SecurityUtils;
import com.app.common.utils.bean.BeanUtils;
import com.app.system.domain.AppUser;
import com.app.system.domain.vo.AppUserEditVo;
import com.app.system.mapper.AppUserMapper;
import com.app.system.service.IAppUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 *@author:
 *@program: app-admin
 *@name AppUserServiceImpl
 *@description: APP用户信息
 */
@Service
public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements IAppUserService {

    @Resource
    private AppUserMapper appUserMapper;

    /**
     * 查询app用户信息列表
     * @param appUser
     * @return {@link List}<{@link AppUser}>
     */
    @Override
    public List<AppUser> selectAppUserList(AppUser appUser) {
        return appUserMapper.selectAppUserList(appUser);
    }

    /**
     * 新增APP用户
     * @param appUser
     * @return int
     */
    @Override
    public int insertAppUser(AppUser appUser) {
        appUser.setCreateTime(new Date());
        appUser.setUpdateTime(new Date());
        appUser.setDelFlag(DeleteEnum.NO.getCode());
        return appUserMapper.insert(appUser);
    }

    /**
     * 修改APP用户
     * @param editVo
     * @return int
     */
    @Override
    public int updateAppUser(AppUserEditVo editVo) {
        AppUser appUser = new AppUser();
        BeanUtils.copyProperties(editVo, appUser);
        appUser.setUpdateTime(new Date());
        return appUserMapper.updateAppUser(appUser);
    }



}
